package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
	"os"
	"reflect"
)

func main() {
	mux := http.NewServeMux()
	mux.Handle("/", &myHandler1{})
	mux.HandleFunc("/hello", syHeeo)
	wd, err := os.Getwd()
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(wd)
	fmt.Println(reflect.TypeOf(http.Dir(wd)))

	//log.Fatal(wd)
	mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(wd))))
	err = http.ListenAndServe(":8080", mux)
	if err != nil {
		log.Fatal(err)
	}
}

type myHandler1 struct {
}

func (this *myHandler1) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	io.WriteString(w, "URL"+r.URL.String())
}
func syHeeo(w http.ResponseWriter, r *http.Request) {
	io.WriteString(w, "ok")
}
